package string;

/**
 * String和StringBuilder的对比
 */
public class StringStringBuilderDemo {
    public static void main(String[] args) {
        /*
        StringBuilder s = new StringBuilder("a");
        for(int i=0;i<10000000;i++){
            s.append(i);
        }
        System.out.println("执行完毕");
        */


        //String不适合频繁修改内容（效率低）
        String s="a";
        StringBuilder builder=new StringBuilder(s);
        for (int i=0;i<10000000;i++){
            builder.append(i);
        }
        System.out.println("执行完毕");
    }
}
